package com.situ.b2c.address.service;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.omg.CORBA.Request;

import com.situ.b2c.address.dao.AddrDao;
import com.situ.b2c.pojo.Address;
import com.situ.b2c.pojo.Area;
import com.situ.b2c.pojo.User;
import com.situ.b2c.util.JDBCUtil;

public class AddrService {
	AddrDao addrDao = new AddrDao();
	
	public int insert(Address address,HttpServletRequest request) {
		HttpSession session = request.getSession();
		User user = (User)session.getAttribute("login_user");
		if (user != null) {
			address.setUserId(user.getRowId());
		}
		return addrDao.insert(address);

	}
	
	public List<Address> selectAddress(Long userId ,HttpServletRequest request) {
		 
		
		return addrDao.selectAddress(userId);
	}

	public List<Area> selectAreas(Integer parentCode){
		
		return addrDao.selectAreas(parentCode);
	}
	
	
	public Address selectOneById(Long rowId) {
		
		return addrDao.selectOneById(rowId);
		
		
	}
	
	
	
	
	
	
	
	
	
	
//	public List<Area> seleAreasProvince(Integer provinceCode){
//		
//		
//		return addrDao.selectAreasName(provinceCode);
//	}
//	
//	public List<Area> seleAreasCity(Integer cityCode){
//		
//		
//		return addrDao.selectAreasName(cityCode);
//	}
//	
//	public List<Area> seleAreasDis(Integer districtCode){
//	
//	
//	return addrDao.selectAreasName(districtCode);
//}
	
}
